package com.cloudfun.campusshare.common.model.dto;

import com.cloudfun.campusshare.common.constant.BaseConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.groups.Default;

/**
 * Created by Huqin on 2020/5/9
 */
@Data
@ApiModel(value = "账号创建DTO")
public class AccountCreateDTO {

    @ApiModelProperty(value = "用户名")
    @NotEmpty(message = "用户名不能为空", groups = Create.class)
    private String username;

    @ApiModelProperty(value = "手机号")
    @NotEmpty(message = "手机号不能为空", groups = Create.class)
    @Pattern(regexp = BaseConstant.PHONE_REGEX_PATTERN, message = "手机号错误")
    private String phone;

    @ApiModelProperty("角色id")
    @NotEmpty(message = "角色不能为空", groups = Create.class)
    private String roleId;

    @ApiModelProperty("描述")
    @NotEmpty(message = "描述不能为空", groups = Create.class)
    @Length(max = 40, message = "描述限制40个字")
    private String description;

    public static interface Create extends Default {

    }

}
